package com.sky.mapper;

import com.sky.Entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    void add(ShoppingCart cart);


    Long queryCount(ShoppingCart cart);

    void update(ShoppingCart cart);

    @Select("select * from shopping_cart where user_id=#{userId}")
    List<ShoppingCart> queryByUserId(Long userId);

    void reduceOnce(ShoppingCart cart);

    void delete(ShoppingCart cart);

    @Delete("delete from shopping_cart where user_id=#{userId}")
    void deleteByUserId(Long userId);

    ShoppingCart query(ShoppingCart cart);
}
